#include <iostream>

int const maxn = 12;
long long f[2][1<<maxn];
int n, m, len, current;

void init_f(int c) { for (int i = 0; i < len; i++) f[c][i] = 0; }

void dfs(int row, int col, int row_s, int prow_s) // current row state && previous row state
{
	if (col == m) f[current][row_s] += f[current ^ 1][prow_s];
	if (col >= m) return;

	// put vertically
	if (row > 1)
		dfs(row, col + 1, row_s * 2 + 1, prow_s * 2);

	// put sideway
	dfs(row, col + 2, row_s * 4 + 3, prow_s * 4 + 3);

	// left empty
	dfs(row, col + 1, row_s * 2    , prow_s * 2 + 1);
}

int main()
{
	while (std::cin >> n >> m && (n || m)) {
		if ((n & m) & 1) { std::cout << "0\n"; continue; }
		len = 1 << m;
		init_f(current); f[current][len - 1] = 1;

		for (int i = 1; i <= n; i++) {
			current ^= 1; init_f(current);
			dfs(i, 0, 0, 0);
		}
		std::cout << f[current][len-1] << '\n';
	}
}

